<?php
declare(strict_types=1);
// 用户后台导航菜单
namespace app\admin_v1\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class Menu extends Model
{
  protected $table = "admin__sys_t_system_menu_admin"; //操作数据表
  // protected $connection = "mysql_20"; // 设置当前模型的数据库连接
  // protected $disuse = ["status", "type"]; // 设置废弃字段
  // protected $strict = false; // 模型数据不区分大小写
  // protected $convertNameToCamel = true; // 数据转换为驼峰命名
  // protected $autoWriteTimestamp  = false; //自动写入:创建和更新的时间戳字段(默认关闭)
  // 定义时间戳字段名
  // protected $createTime = "time_new"; //创建时间戳字段
  // protected $updateTime = false; // 关闭自动写入字段
  // 设置只读字段
  protected $readonly = ["Idx",];
  // 定义字段的类型
  protected $schema = [
    "Idx" => "int", //主键
    "id" => "string", //ID
    "pid" => "string", //父ID
    "icon" => "string", //图标
    "name" => "string", //名称标题
    "type" => "string", //A链接时弹窗类型blank原生跳转modal弹层外链_空值表示当前菜单不是链接
    "i" => "int", //排序
    "ids" => "string", //子ID集合
    "pids" => "string", //父ID集合
    "end_node" => "int", //末端节点_0否1是




    "show" => "int",//展示1是0否
    "route_name" => "string",//路由名称
    "route_path" => "string",//路由路径
    "route_compont_path" => "string",//组件路径
    "route_meta_title" => "string",//路由meta_标题
    "route_meta_requireAuth" => "string",//路由meta_需要身份验证
    "route_meta_closable" => "string",//路由meta_可否关闭








  ];
  public static function onBeforeInsert($user)
  {
    //新增前
    // if ("thinkphp" == $user->name) {
    //   	return false;
    //   }
    // return "新增前";
    // exit();
  }
  public static function onAfterWrite($user)
  {
    //写入后
    // if ("thinkphp" == $user->name) {
    //   	return false;
    //   }
    // echo "写入后";
    // return true;
    // exit();
  }
}
